<!DOCTYPE html>
<html lang="zh">
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="common/header :: header(~{::title},~{::link},~{})">
    <title>临窗旋墨-搜索</title>
    <link rel="stylesheet" th:href="@{/css/jianshu.css}"/>
    <link rel="stylesheet" th:href="@{/css/style.css}">
</head>
<body class="body">
<!--导航-->
<div th:replace="common/nav :: nav(false)"></div>
<div class="container-fluid">
    <div class="row">
        <div style="margin-top: 20px;"></div>
        <div class="col-lg-2  col-sm-2 col-md-2"></div>
        <div class="col-lg-7  col-sm-7 col-md-7">

            <form class="form lookup" role="form" method="post">
                <div class="input-group">
                    <input type="text" class="form-control" th:value="${pager.lookup.keyword}" name="keyword">
                    <div class="input-group-btn">
                        <button type="submit" class="btn btn-default" tabindex="-1">
                            <i class="fa fa-search"></i>
                        </button>
                    </div>
                </div>
            </form>
            <!--文章列表-->
            <div th:replace="common/articles :: articles"></div>
            <!--页码相关-->
            <div th:replace="common/pager :: pager"></div>
        </div>

        <div class="col-lg-2  col-sm-2 col-md-2">

        </div>
    </div>
</div>
<!-- 引入通用js-->
<div th:replace="common/footer :: footer"></div>
<script>
    $(function () {
        changeUrl();
        // 初始化页码
        $("form ul.pagination").pager();

        $(document).keypress(function(e) {
            if (e.which == 13){
                $("form.lookup").trigger("click");
            }
        });


    });


    // 把url后的参数去掉
    function changeUrl(){
        var href = location.href;
        var index = href.indexOf("?");
        if(index > 0) {
            href = href.substring(0, index);
        }
        history.pushState({}, null, href);
    }

</script>
</body>
</html>
